﻿@model HmPMer.Entity.InterfaceAccount

@{
    Layout = "~/Views/Shared/_Content.cshtml";
}

<style>
    .linksAdd .layui-form-label {
        width: 100px;
    }

    .linksAdd .layui-input-block {
        margin-left: 120px;
    }
</style>

<body class="childrenBody">
    <form class="layui-form linksAdd" id="formdata">
        @Html.Hidden("IsEnabled", Model.IsEnabled)
        @Html.Hidden("Id", Model.Id)
        <div class="layui-form-item">
            <label class="layui-form-label">接口商编号</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input inputreadonly" id="Code" name="Code" value="@Model.Code" lay-verify="required" readonly placeholder="请输入编号" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">接口商商户号</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="Account" name="Account" value="@Model.Account" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">子商户号</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="ChildAccount" name="ChildAccount" value="@Model.ChildAccount" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">MD5秘钥</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="MD5Pwd" name="MD5Pwd" value="@Model.MD5Pwd" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">RSA公钥</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="RSAOpen" name="RSAOpen" value="@Model.RSAOpen" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">RSA私钥</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="RSAPrivate" name="RSAPrivate" value="@Model.RSAPrivate" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">Open密钥</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="OpenPwd" name="OpenPwd" value="@Model.OpenPwd" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">Appid</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="Appid" name="Appid" value="@Model.Appid" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">提交域名</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="SubDomain" name="SubDomain" value="@Model.SubDomain" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">绑定域名</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="BindDomain" name="BindDomain" value="@Model.BindDomain" lay-verify="required" />
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input linkName" id="OrderNo" name="OrderNo" value="@Model.OrderNo" onkeyup="this.value=this.value.replace(/[^\d{1-9}{1}\d{0-9}]/g,'')" onafterpaste="this.value=this.value.replace(/[^\d{1-9}{1}\d{0-9}]/g,'')" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item" style="text-align:center">
            <button class="layui-btn" lay-filter="" style="width:100px" type="button" id="btn_Add">提交</button>
        </div>
    </form>
</body>

<script>

    layui.use(['hm', 'form', 'layer', 'laydate', 'table', 'laytpl'], function () {
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            hm = layui.hm;

        //提交数据
        $("#btn_Add").click(function () {

            var index = layer.msg('操作中，请稍候', { icon: 16, time: false, shade: 0.8 });
            setTimeout(function () {
                layer.close(index);
                hm.ajax("/Interface/UpdateInterfaceAccountInfo", {
                    data: $("#formdata").serialize(),
                    type: "POST",
                    dataType: 'json',
                    success: function (result) {
                        if (result.Success) {
                            layer.msg("操作成功！", { icon: 1, time: 300 });
                            var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                            parent.tableIns.reload();
                            parent.layer.close(index);
                        } else {
                            layer.msg(result.Message);
                        }
                    },
                    error: function (x, t, e) {
                        layer.closeAll();
                    }
                });

            }, 500);

        });

    })
</script>

